/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "BANQUET")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Banquet.findAll", query = "SELECT b FROM Banquet b"),
    @NamedQuery(name = "Banquet.findByIdBanque", query = "SELECT b FROM Banquet b WHERE b.banquetPK.idBanque = :idBanque"),
    @NamedQuery(name = "Banquet.findByIdCtBq", query = "SELECT b FROM Banquet b WHERE b.banquetPK.idCtBq = :idCtBq")})
public class Banquet implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BanquetPK banquetPK;
    @JoinColumn(name = "ID_CT_BQ", referencedColumnName = "ID_CT", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Comptet comptet;

    public Banquet() {
    }

    public Banquet(BanquetPK banquetPK) {
        this.banquetPK = banquetPK;
    }

    public Banquet(int idBanque, int idCtBq) {
        this.banquetPK = new BanquetPK(idBanque, idCtBq);
    }

    public BanquetPK getBanquetPK() {
        return banquetPK;
    }

    public void setBanquetPK(BanquetPK banquetPK) {
        this.banquetPK = banquetPK;
    }

    public Comptet getComptet() {
        return comptet;
    }

    public void setComptet(Comptet comptet) {
        this.comptet = comptet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (banquetPK != null ? banquetPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Banquet)) {
            return false;
        }
        Banquet other = (Banquet) object;
        if ((this.banquetPK == null && other.banquetPK != null) || (this.banquetPK != null && !this.banquetPK.equals(other.banquetPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Banquet[ banquetPK=" + banquetPK + " ]";
    }
    
}
